<template>
	<view class="content">
		<view class="row b-b">
			<view class="textop">旧密码:</view>
		    <input class="input" type="text" v-model="pwd" placeholder="请输入旧密码" password placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<view class="textop">新密码:</view>
		    <input class="input" type="text" v-model="npwd" placeholder="请输入新密码" password placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<view class="textop">确认新密码:</view>
		    <input class="input" type="text" v-model="npwds" placeholder="再次输入新密码" password placeholder-class="placeholder" />
		</view>
		<button class="add-btn" @click="confirm">确定</button>
	</view>
</template>

<script>
	import { mapActions } from 'vuex'
	
	export default {
		data() {
			return {
					pwd: '',//旧密码
					npwd: '',// 新密码
					npwds: ''// 新密码再次
			}
		},
		onLoad(option){
	
		},
		methods: {
			//提交
			confirm(){
				if(!this.pwd){
					this.$api.msg('请填写旧密码');
					return;
				}
				if(!this.npwd){
					this.$api.msg('请填写新密码');
					return;
				}
				if(!this.npwds){
					this.$api.msg('请再次输入新密码');
					return;
				}
				this.$http.post('updatepass', {oldpass:this.pwd,newpass:this.npwd,renewpass:this.npwds}).then(res => {
					this.$api.msg(res.msg);
					if(res.code == 1){
						this.$api.msg(res.msg)
						console.log(res)
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 800)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.row{
		display: flex;
		justify-content: flex-start;
		align-items: center;
		position: relative;
		padding:0 30upx;
		height: 110upx;
		background: #fff;
		line-height: 110upx;
		.input{
			flex: 1;
			font-size: 30upx;
			color: $font-color-dark;
			margin-left: 40upx;
			margin-top: 6upx;
		}
		.textop{
			font-size: $font-base + 2upx;
		}
	}
	.add-btn{
		display: flex;
		align-items: center;
		justify-content: center;
		width: 690upx;
		height: 80upx;
		margin: 60upx auto;
		font-size: $font-lg;
		color: #fff;
		background-color: $base-index-color;
		border-radius: 10upx;
		box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
	}
</style>
